package com.emmmya.ocs.modules.system.controller;

import com.emmmya.ocs.common.utils.ResultUtil;
import com.emmmya.ocs.common.vo.Result;
import com.emmmya.ocs.modules.system.annotation.OperateLog;
import com.emmmya.ocs.modules.system.setting.entity.Email;
import com.emmmya.ocs.modules.system.utils.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("email")
public class EmailController {

    @Autowired
    EmailService emailService;


    @RequestMapping("/send")
    @OperateLog(value="发送邮件",logType = 1,operateType = 0,module = "邮箱模块")
    public Result<Object> send(@RequestBody Email email){
//        emailService.sendTemplateEmail(email.getTo(),email.getTitle(),"index.html",email);
        emailService.sendTemplateEmail(email);
        return ResultUtil.success("成功！");
    }
}
